# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=sink
pkgver=0.9.0
pkgrel=1
pkgdesc="Offline caching, synchronization and indexing system for PIM data"
arch="all !armhf" # limited by flatbuffers
url="https://community.kde.org/KDE_PIM"
license="LicenseRef-KDE-Accepted-GPL"
depends_dev="
	curl-dev
	flatbuffers-dev
	gpgme-dev
	kasync-dev
	kcalendarcore-dev
	kcontacts-dev
	kdav2-dev
	kimap2-dev
	kmime-dev
	libexecinfo-dev
	lmdb-dev
	qt5-qtbase-dev
	samurai
	xapian-core-dev
	"
makedepends="$depends_dev extra-cmake-modules"
checkdepends="xvfb-run"
source="https://invent.kde.org/pim/sink/-/archive/v$pkgver/sink-v$pkgver.tar.gz"
subpackages="$pkgname-dev"
options="!check" # Failing tests
builddir="$srcdir/$pkgname-v$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="8f64872827978196178115ea46db655479cf7b88086ff6ec6e60000c5edd57f9cf0d51a8d7cb11660b987a6b3a0f9a8a985e264c6ba988965cfce49a631e428b  sink-v0.9.0.tar.gz"
